/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tools;

/**
 *
 * @author Mika
 */
class MatrixThread implements Runnable {

    Thread runner;
    Matrix m;
    int[][] m1;
    int[][] m2;
    int[][] product;


    public MatrixThread() {
    }

    public MatrixThread(String threadName) {
        runner = new Thread(this, threadName); // (1) Create a new thread.
        System.out.println(runner.getName());
        runner.start(); // (2) Start the thread.
    }
    
    public MatrixThread(int[][] m1, int[][] m2, String threadName) {
        m = new Matrix();
        this.m1 = m1;
        this.m2 = m2;
        runner = new Thread(this, threadName); // (1) Create a new thread.
        //System.out.println(runner.getName());
        runner.start(); // (2) Start the thread.
    }

    public void run() {
        product = m.multiply(m1, m2);
        //Matrix.mprint(product);
        //Display info about this particular thread
        //System.out.println("@HAPPY THREAD:" + Thread.currentThread());
    }
    
    public int[][] getProduct() {
        return this.product;
    }
    
    public Thread getThread() {
        return this.runner;
    }
}